#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

class Solution
{
 public:
  int sumNums(int n)
  {
    int sum;
    if (n < 0) return -1;
    if (n == 0) return sum;
    sum = sum + sumNums(n - 1) + n;
  }

  int getSum(int n)
  {
    int res = n;
    (n > 0) && (res += getSum(n - 1));  // 利用短路运算终止递归
    return res;
  }
};
